Skip to content

Remove public_scan_b field#13083

Open
bettercallok wants to merge 4 commits into
internetarchive:masterfrom
bettercallok:11586/feature/rewrite-public-scan-b
Open

Remove public_scan_b field#13083
bettercallok wants to merge 4 commits into
internetarchive:masterfrom
bettercallok:11586/feature/rewrite-public-scan-b

Conversation

@bettercallok

Copy link
Copy Markdown
Contributor

Closes #11586

Refactor: Deprecates and removes the public_scan_b Solr field and relies on ebook_access:public while maintaining backward compatibility for search queries.

Technical

  • Schema & Types: Removed public_scan_b from solr_types.py, types_generator.py, and the dynamic *_b field mappings in managed-schema.xml.
  • Indexing: Stripped the public_scan_b extraction properties from WorkSolrUpdater and EditionSolrUpdater (openlibrary/solr/updater/edition.py & openlibrary/solr/updater/work.py).
  • Query Rewrites: Updated WorkSearchScheme (openlibrary/plugins/worksearch/schemes/works.py) to rewrite public_scan_b:true to ebook_access:public and public_scan_b:false to -ebook_access:public. This ensures legacy URL facets won't break.
  • Codebase Cleanup: Updated openlibrary/core/models.py, openlibrary/plugins/worksearch/subjects.py, and openlibrary/plugins/worksearch/code.py to deduce public_scan natively from ebook_access == "public" (or via checking if ia exists).
  • Template Clean-up: Removed instances of public_scan_b from UI components like openlibrary/templates/home/index.html, openlibrary/templates/work_search.html, and search facet templates, switching to ebook_access:public logic where necessary.
  • Testing: Removed assertions relating to public_scan_b in openlibrary/tests/solr/updater/test_work.py and openlibrary/plugins/worksearch/tests/test_worksearch.py.

Screenshot

N/A - Strictly backend/search logic adjustments.

Stakeholders

@cdrini

@openlibrary-bot

Copy link
Copy Markdown
Collaborator

Thanks for the PR, @bettercallok!

@cdrini is assigned to this PR and currently has:

  • 29 open PR(s) of equal or higher priority to review first

Possible improvements for this PR

  • Test cases — this PR adds new query-rewrite logic (public_scan_b_transform in openlibrary/plugins/worksearch/schemes/works.py) but the only test changes are removed assertions (test_worksearch.py, test_work.py). Consider adding a test that exercises the public_scan_b:true / public_scan_b:false rewrite paths.
  • Proof of testing — the PR body notes "N/A - Strictly backend/search logic adjustments" for the screenshot section, but doesn't describe what was run/verified. A brief note on how the query rewrite was tested (e.g. manual query, test run output) would help the reviewer. See attaching files to a PR if a screenshot/log is easiest.
PR triage checklist (maintainers / Richy)
  • PR description — not empty; explains what the change does and how to verify it
  • References an issue — PR body contains a #NNN reference
    • Linked issue is triaged — has a Priority: * label (not just Needs: Triage)
    • Linked issue is assigned — has at least one assignee
  • Commit history clean — no WIP/fixup/conflict noise; commit messages are meaningful
  • CI passing — no failing check-runs (checks still running as of this comment)
  • Test cases present — if the change touches substantive logic, test coverage exists or is explained
  • Proof of testing — PR body includes a description of what was tested, a screenshot, or a video

Note

This comment was automatically generated by PAM, Open Library's Project AI Manager. PAM provides status visibility, performs basic project management functions, and gives actionable feedback so contributors aren't left waiting.

@openlibrary-bot openlibrary-bot added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Jul 1, 2026
@github-actions github-actions Bot added Needs: Response Issues which require feedback from lead and removed Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] labels Jul 1, 2026
@mekarpeles mekarpeles removed the Needs: Response Issues which require feedback from lead label Jul 4, 2026

@cdrini cdrini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great looking very close! A few issues that were preventing this from working. I've made some fixed to now allow the rewrite to work. Can you review the changes and test things in your local environment to ensure everything is working? A few small focused tests around the new behaviour might also be helpful. Thank you @bettercallok !

@cdrini cdrini added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove some legacy IA-related solr fields

4 participants